package main

import "net/http"

type IndexCtl struct {
	w http.ResponseWriter
}

func (this *IndexCtl) Index(req *http.Request) {
	this.w.Write([]byte(req.RequestURI))
}
func (this *IndexCtl) UserInfo(req *http.Request) {
	this.w.Write([]byte(req.Method))
}
func web(f func(ctl *IndexCtl, req *http.Request)) http.HandlerFunc {
	return func(writer http.ResponseWriter, request *http.Request) {
		f(&IndexCtl{w: writer}, request)
	}
}
func main() {
	router := http.NewServeMux()
	router.HandleFunc("/", web((*IndexCtl).Index))
	router.HandleFunc("/user/info", web((*IndexCtl).UserInfo))
	http.ListenAndServe(":8080", router)
}
